<?php $this->headTitle(__('Customers')); ?>
<div id="maincontent">
	<?php echo $this->searchForm(__('Search Customer')); ?>
	<table width="100%">
		<thead>
			<th><?php echo $this->sortLink(__('First Name'),'fname') ?></th>
			<th><?php echo $this->sortLink(__('Last Name'),'lname','cIndex') ?></th>
			<th><?php echo $this->sortLink(__('Permanent Address'),'address') ?></th>
            <th><?php echo $this->sortLink(__('Bank'),'bankName','cIndex') ?></th>
    		<th class="action"><?php echo __('Action'); ?></th>
		</thead>
		<tbody>
			<?php if($this->customers): ?>
				<?php foreach($this->customers as $key => $customer): ?>
					<tr class="<?php echo ($key % 2 == 0)?'even':'odd'; ?>">
						<td><?php echo $customer['first_name']; ?></td>
						<td><?php echo $customer['last_name']; ?></td>
						<td><?php echo $customer['permanent_address'] ?></td>
                        <td><?php echo $customer['bankName'] ?></td>
                        <td><a class="edit" href="<?php echo $this->baseUrl('customer/edit/'.Custom_General::encode($customer['id'])); ?><?php echo ($this->page)?"/page/".$this->page:''; ?>">&nbsp;</a>
								<a class="delete"
								   del:url="<?php echo $this->siteURL.'/customer/delete/'.Custom_General::encode($customer['id']); ?><?php echo ($this->page)?"/page/".$this->page:''; ?>">&nbsp;
								</a>
							<a class="show" href="<?php echo $this->baseUrl('customer/show/'.Custom_General::encode($customer['id'])); ?>">&nbsp;</a>
						</td>
					</tr>
				<?php endforeach; ?>
			<?php else: ?>
					<tr><td colspan="6" align="center"><?php echo __('Customer not found'); ?></td></tr>
			<?php endif; ?>
		</tbody>
	</table>
	<?php echo $this->pagination();?>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$('.delete').click(function(){
		setDeleteDialog($(this).attr('del:url'), "Are you sure, you want to delete this customer ?");
	});
});
</script>